<extend name="Public/base"/>
<block name="body">
  <div class="main-title">
    <h2>{$meta_title}</h2>
  </div>
  <form action="{:U('edit')}" method="post" class="form-horizontal">
    <div class="form-item">
      <label class="item-label">模板名称：</label>
      <div class="controls">
        <input type="text" class="text input-large" name="title" value="{$data['title']}">
      </div>
    </div>
    <div class="form-item">
      <label class="item-label">运送方式：<span class="text-danger">（除指定地区外，其余地区的运费采用"默认运费"）</span></label>
    </div>
    <div class="form-item">
      <label class="item-label">计价方式</label>
      <div class="controls">
        <label class="checkbox" for="J_pricetype_1">
          <input type="radio" name="price_type" id="J_pricetype_1" class="radio J_express_pricetype" value="1"  data-type="quantity">
          按件数</label>
        <label class="checkbox" for="J_pricetype_2">
          <input type="radio" name="price_type" id="J_pricetype_2" class="radio J_express_pricetype" value="2" data-type="weight">
          按重量</label>
        <div class="delivery-type">
          <div id="J_express_quantity" class="item J_express_item">
            <div class="default">默认运费：
              <input type="text" name="express_start" data-field="start" class="text input-mini" autocomplete="off" maxlength="6">
              <span class="J_express_unit">{$data['express_unit'] ? $data['express_unit'] : '件'}</span>内，
              <input type="text" data-field="postage" name="express_postage" class="text input-mini" autocomplete="off" maxlength="6">
              元，
              每增加
              <input type="text" name="express_plus" data-field="plus" class="text input-mini" autocomplete="off" maxlength="6">
              <span class="J_express_unit">{$data['express_unit'] ? $data['express_unit'] : '件'}</span>，
              增加运费
              <input type="text" name="express_postageplus" data-field="postageplus" class="text input-mini " autocomplete="off" maxlength="6">
              元 </div>
          </div>
        </div>
      </div>
    </div>
    <div class="order-item-table mb-10">
      <table class="dynamic-table">
        <thead>
          <tr>
            <th>运送到</th>
            <th width="60">首件(个)</th>
            <th width="110">运费(元)</th>
            <th width="60">续件(个)</th>
            <th width="110">运费(元)</th>
            <th width="110">操作</th>
          </tr>
        </thead>
        <tbody class="J_zoneList">
        <volist name="data.extend" id="vo">
            <tr id="n{$key}">
                <td class="area-group">
                    <input type="hidden" class="ids" name="ids[{$key}]" value="{$vo['city']}" />
                    <span>{$vo.area_name}</span>
                </td>
                <td>
                    <input type="text" class="input-mini" maxlength="4" value="{$vo['express_start']|default='1'}" name="kd[{$key}][start]">
                </td>
                <td>
                    <input type="text" class="input-mini" maxlength="6" value="{$vo['express_postage']|default='0.00'}" name="kd[{$key}][postage]">元
                </td>
                <td>
                    <input type="text" class="input-mini" maxlength="4" value="{$vo['express_plus']|default='1'}" name="kd[{$key}][plus]">
                </td>
                <td>
                    <input type="text" class="input-mini" maxlength="6" value="{$vo['express_postageplus']|default='0.00'}" name="kd[{$key}][postageplus]">元
                </td>
                <td>
                    <a href="javascript:;" class="J_delZone text-danger">[删除]</a>
                    <a class="J_transport" href="javascript:;" data-list="n{$key}">[选择地区]</a>
                    <input name="areas[{$key}]" type="hidden" value="{$vo['city']}|||{$vo['area_name']}" />
                </td>
            </tr>
        </volist>
        </tbody>
      </table>
    </div>
    <div class="form-item">
      <div class="controls"><a class="J_setZone" href="javascript:;">指定城市设置运费 +</a></div>
    </div>
    <div class="form-item button-item">
      <input type="hidden" name="id" value="{$data.id}">
      <button class="btn submit-btn ajax-post" id="submit" type="submit" target-form="form-horizontal">确 定</button>
      <a href="{:U('Transport/index')}" class="btn btn-return">返 回</a> </div>
  </form>
</block>
<block name="script"> 
  <script type="text/javascript">
    $(function(){
      //导航高亮
      highlight_subnav("{:U('index')}");
      //运费模板
      Core.setValue('price_type', '{$data.type|default = 1}');
      Core.setValue('express_start', "{$data['express_start']|default = 1}");
      Core.setValue('express_postage', "{$data['express_postage']|default = 8}");
      Core.setValue('express_plus', "{$data['express_plus']|default = 1}");
      Core.setValue('express_postageplus', "{$data['express_postageplus']|default = 12}");
      (function(){
        delivery.init("{:U('Transport/zone')}");
      })();
    });
  </script> 
</block>
